package org.reliablesource.prism.gef.editor.parts;

import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
import org.reliablesource.prism.gef.editor.figures.PointerFigure;
/**
 * 
 * PointerLocationEditPart.java
 *  
 * Handles selection of PointerLocation. Primary selection is denoted by
 * 	highlight and a focus rectangle. Normal selection is denoted by highlight
 * 	only.
 * 
 * Copyright (c) 2006, Reliable Source, Inc. All Rights Reserved
 * 
 * Created on: Apr 12, 2006
 * 
 * @author Dennis Park <a
 *         href="mailto:dennis.park@gmail.com">dennis.park@gmail.com</a>
 * 
 */
public class PointerLocationSelectionEditPolicy extends NonResizableEditPolicy {

	private PointerFigure getImageFigure() {
		PointerLocationEditPart part = (PointerLocationEditPart) getHost();
		return ((PointerFigure) part.getFigure());
	}

	/**
	 * @see org.eclipse.gef.editpolicies.NonResizableEditPolicy#hideFocus()
	 */
	protected void hideFocus() {
		getImageFigure().setFocus(false);
	}

	/**
	 * @see org.eclipse.gef.editpolicies.SelectionHandlesEditPolicy#hideSelection()
	 */
	protected void hideSelection() {
		getImageFigure().setSelected(false);
		getImageFigure().setFocus(false);

	}

	/**
	 * @see org.eclipse.gef.editpolicies.NonResizableEditPolicy#showFocus()
	 */
	protected void showFocus() {
		getImageFigure().setFocus(true);

	}

	/**
	 * @see org.eclipse.gef.editpolicies.SelectionHandlesEditPolicy#showSelection()
	 */
	protected void showPrimarySelection() {
		
		getImageFigure().setSelected(true);
		getImageFigure().setFocus(true);
	}

	/**
	 * @see org.eclipse.gef.editpolicies.SelectionHandlesEditPolicy#showSelection()
	 */
	protected void showSelection() {
		getImageFigure().setSelected(true);
		getImageFigure().setFocus(false);
	}

}
